package com.example.entity;

import jakarta.persistence.*;

@Entity
@Table(name = "driver")
public class Driver {

    @Id
    @Column(name = "license_number", unique = true, nullable = false)
    private String licenseNumber;

    private String name;

    private DriverStatus status;

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "vehicle_license_plate", referencedColumnName = "license_plate", insertable = true, updatable = false)
    private Vehicle vehicle;

    public Driver() {
    }

    public Driver(String name, String licenseNumber,Vehicle vehicle) {
        this.name = name;
        this.licenseNumber = licenseNumber;
        this.status = DriverStatus.APPROVED;
        this.vehicle = vehicle;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLicenseNumber() {
        return licenseNumber;
    }

    public void setLicenseNumber(String licenseNumber) {
        this.licenseNumber = licenseNumber;
    }



    public DriverStatus getStatus() {
        return status;
    }

    public void setStatus(DriverStatus status) {
        this.status = status;
    }

    public Vehicle getVehicle() {
        return vehicle;
    }

    public void setVehicle(Vehicle vehicle) {
        this.vehicle = vehicle;
    }
}

